package com.marutea.sample.Objects;

import java.util.Random;


import android.graphics.PointF;
  
public enum BlockType {
    T(0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f),
    X(-0.5f, 0.5f, 0.5f, 0.5f, -0.5f, -0.5f, 0.5f, -0.5f),
    L(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, -1.0f),
    J(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f),
    B(0.0f, -1.5f, 0.0f, -0.5f, 0.0f, 0.5f, 0.0f, 1.5f),
    S(-0.5f, 0.0f, 0.5f, 0.0f, -0.5f, 1.0f, 0.5f, -1.0f),
    Z(-0.5f, 0.0f, 0.5f, 0.0f, -0.5f, -1.0f, 0.5f, 1.0f),
    EMPTY(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
  
    private static int NUM_OF_BLOCKTYPES = 7;
    private static Random s_rand = new Random();
  
    public static BlockType random() {
        return valueOf(s_rand.nextInt(NUM_OF_BLOCKTYPES));
    }
  
    public static BlockType valueOf(int a_value) {
        switch (a_value) {
        case 0: return T;
        case 1: return X;
        case 2: return L;
        case 3: return J;
        case 4: return B;
        case 5: return S;
        case 6: return Z;
        } // switch
  
        return EMPTY;
    }
  
    private PointF [] m_points;
  
    private BlockType(float a_x0, float a_y0,
            float a_x1, float a_y1,
            float a_x2, float a_y2,
            float a_x3, float a_y3) {
  
        m_points = new PointF[Block.NUM_OF_CELLS];
        m_points[0] = new PointF(a_x0, a_y0);
        m_points[1] = new PointF(a_x1, a_y1);
        m_points[2] = new PointF(a_x2, a_y2);
        m_points[3] = new PointF(a_x3, a_y3);
    }
  
    public PointF getPoint(int a_i) {
        return m_points[a_i];
    }
}